'\" t
'\"! tbl | mmdoc
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 24 September 1999
.ds Re Release 1.2.1
.ds Dp Jan 14 18:30
.ds Dm 001 copyconv
.ds Xs 51319 8 copyconvolutionfilter2d.gl
.TH GLCOPYCONVOLUTIONFILTER2D 3G
.SH NAME
.B "glCopyConvolutionFilter2D
\- copy pixels into a two-dimensional convolution filter

.SH C SPECIFICATION
void \f3glCopyConvolutionFilter2D\fP(
GLenum \fItarget\fP,
.nf
.ta \w'\f3void \fPglCopyConvolutionFilter2D( 'u
	GLenum \fIinternalformat\fP,
	GLint \fIx\fP,
	GLint \fIy\fP,
	GLsizei \fIwidth\fP,
	GLsizei \fIheight\fP )
.fi

.SH PARAMETERS
.TP \w'\fIinternalformat\fP\ \ 'u 
\f2target\fP
Must be \%\f3GL_CONVOLUTION_2D\fP.
.TP
\f2internalformat\fP
The internal  of the convolution filter kernel.
The allowable values are
\%\f3GL_ALPHA\fP,
\%\f3GL_ALPHA4\fP,
\%\f3GL_ALPHA8\fP,
\%\f3GL_ALPHA12\fP,
\%\f3GL_ALPHA16\fP,
\%\f3GL_LUMINANCE\fP,
\%\f3GL_LUMINANCE4\fP,
\%\f3GL_LUMINANCE8\fP,
\%\f3GL_LUMINANCE12\fP,
\%\f3GL_LUMINANCE16\fP,
\%\f3GL_LUMINANCE_ALPHA\fP,
\%\f3GL_LUMINANCE4_ALPHA4\fP,
\%\f3GL_LUMINANCE6_ALPHA2\fP,
\%\f3GL_LUMINANCE8_ALPHA8\fP,
\%\f3GL_LUMINANCE12_ALPHA4\fP,
\%\f3GL_LUMINANCE12_ALPHA12\fP,
\%\f3GL_LUMINANCE16_ALPHA16\fP,
\%\f3GL_INTENSITY\fP,
\%\f3GL_INTENSITY4\fP,
\%\f3GL_INTENSITY8\fP,
\%\f3GL_INTENSITY12\fP,
\%\f3GL_INTENSITY16\fP,
\%\f3GL_R3_G3_B2\fP,
\%\f3GL_RGB\fP,
\%\f3GL_RGB4\fP,
\%\f3GL_RGB5\fP,
\%\f3GL_RGB8\fP,
\%\f3GL_RGB10\fP,
\%\f3GL_RGB12\fP,
\%\f3GL_RGB16\fP,
\%\f3GL_RGBA\fP,
\%\f3GL_RGBA2\fP,
\%\f3GL_RGBA4\fP,
\%\f3GL_RGB5_A1\fP,
\%\f3GL_RGBA8\fP,
\%\f3GL_RGB10_A2\fP,
\%\f3GL_RGBA12\fP, or
\%\f3GL_RGBA16\fP.
.TP
\f2x\fP, \f2y\fP
The window space coordinates of the lower-left coordinate of the
pixel array to copy.
.TP
\f2width\fP
The width of the pixel array to copy.
.TP
\f2height\fP
The height of the pixel array to copy.
.SH DESCRIPTION
\%\f3glCopyConvolutionFilter2D\fP defines a two-dimensional convolution filter kernel with pixels
from the current \%\f3GL_READ_BUFFER\fP (rather than from main memory, 
as is the case for \%\f3glConvolutionFilter2D\fP).
.sp
The screen-aligned pixel rectangle with lower-left corner at (\f2x\fP,\ \f2y\fP),
width \f2width\fP and height \f2height\fP
is used to define the convolution filter. If any pixels within this
region are 
outside the window that is associated with the GL context, the 
values obtained for those pixels are undefined.
.sp
The pixels in the rectangle are processed 
exactly as if \%\f3glReadPixels\fP had been called with \f2format\fP
set to RGBA, but the process stops just before final conversion.  
The R, G, B, and A components of each pixel are next scaled by the four
2D \%\f3GL_CONVOLUTION_FILTER_SCALE\fP parameters and biased by the
four 2D \%\f3GL_CONVOLUTION_FILTER_BIAS\fP parameters.
(The scale and bias parameters are set by \%\f3glConvolutionParameter\fP
using the \%\f3GL_CONVOLUTION_2D\fP target and the names
\%\f3GL_CONVOLUTION_FILTER_SCALE\fP and \%\f3GL_CONVOLUTION_FILTER_BIAS\fP.
The parameters themselves are vectors of four values that are applied to red,
green, blue, and alpha, in that order.)
The R, G, B, and A values are not clamped to [0,1] at any time during this
process.
.sp
Each pixel is then converted to the internal  specified by
\f2internalformat\fP.
This conversion simply maps the component values of the pixel (R, G, B,
and A) to the values included in the internal  (red, green, blue,
alpha, luminance, and intensity).  The mapping is as follows:
.sp
.TS
center;
lb cb cb cb cb cb cb
l c c c c c c.
_
Internal Format	Red	Green	Blue	Alpha	Luminance	Intensity
_
\%\f3GL_ALPHA\fP				A
\%\f3GL_LUMINANCE\fP				R
\%\f3GL_LUMINANCE_ALPHA\fP			A	R
\%\f3GL_INTENSITY\fP						R
\%\f3GL_RGB\fP	R	G	B
\%\f3GL_RGBA\fP	R	G	B	A
_
.TE
.sp
The red, green, blue, alpha, luminance, and/or intensity components of
the resulting pixels are stored in floating-point rather than integer
.
.sp
Pixel ordering is such that lower x screen coordinates correspond to 
lower \f2i\fP filter image coordinates, and lower y screen coordinates 
correspond to lower \f2j\fP filter image coordinates.  
.PP
Note that after a convolution is performed, the resulting color
components are also scaled by their corresponding
\%\f3GL_POST_CONVOLUTION_c_SCALE\fP parameters and biased by their
corresponding \%\f3GL_POST_CONVOLUTION_c_BIAS\fP parameters (where
\f2c\fP takes on the values \f3RED\fP, \f3GREEN\fP, \f3BLUE\fP, and
\f3ALPHA\fP).
These parameters are set by \%\f3glPixelTransfer\fP.
.SH NOTES
\%\f3glCopyConvolutionFilter2D\fP is present only if \%\f3GL_ARB_imaging\fP is returned when \%\f3glGetString\fP
is called with an argument of \%\f3GL_EXTENSIONS\fP.
.SH ERRORS
\%\f3GL_INVALID_ENUM\fP is generated if \f2target\fP is not
\%\f3GL_CONVOLUTION_2D\fP.
.P
\%\f3GL_INVALID_ENUM\fP is generated if \f2internalformat\fP is not one of the
allowable values.
.P
\%\f3GL_INVALID_VALUE\fP is generated if \f2width\fP is less than zero or greater
than the maximum supported value.
This value may be queried with \%\f3glGetConvolutionParameter\fP
using target \%\f3GL_CONVOLUTION_2D\fP and name
\%\f3GL_MAX_CONVOLUTION_WIDTH\fP.
.P
\%\f3GL_INVALID_VALUE\fP is generated if \f2height\fP is less than zero or greater
than the maximum supported value.
This value may be queried with \%\f3glGetConvolutionParameter\fP
using target \%\f3GL_CONVOLUTION_2D\fP and name
\%\f3GL_MAX_CONVOLUTION_HEIGHT\fP.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glCopyConvolutionFilter2D\fP is executed
between the execution of \%\f3glBegin\fP and the corresponding
execution of \%\f3glEnd\fP.
.SH ASSOCIATED GETS
\%\f3glGetConvolutionParameter\fP, \%\f3glGetConvolutionFilter\fP
.SH SEE ALSO
\%\f3glConvolutionFilter2D(3G)\fP,
\%\f3glConvolutionParameter(3G)\fP,
\%\f3glPixelTransfer(3G)\fP
